import React from 'react';
import ReactDOM from 'react-dom';
import * as serviceWorker from './serviceWorker';
import { Provider } from 'react-redux';
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
import { LocaleProvider } from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import moment from 'moment';
import 'moment/locale/zh-cn';
import store from './store';
// import Page from './Page';

import NotFound from './components/pages/NotFound';
import SignIn from './pages/signIn/SignIn';
import App from './App';

import './style/lib/animate.css';
import './style/antd/index.less';
import './style/index.less';

moment.locale('zh-cn');

const rootElement = (
  <Provider store={store}>
    <React.Fragment>
      <LocaleProvider locale={zh_CN}>
        <Router>
          <Switch>
            {/* <Route render={props => <Page {...props} />} /> */}
            <Route exact path="/" render={() => <Redirect to="/admin/index" push />} />
            <Route path="/admin" component={App} />
            <Route path="/404" component={NotFound} />
            <Route path="/login" component={SignIn} />
            <Route component={NotFound} />
          </Switch>
        </Router>
      </LocaleProvider>;
    </React.Fragment>
  </Provider>
);
ReactDOM.render(rootElement, document.getElementById('root'));
serviceWorker.unregister();
